feat: Automatically install wasm32-unknown-unknown #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements #9
This commit enables automatic installation of the wasm32-unknown-unknown target for the
build
andcheck
commands.The installation will be performed if:
target
param is specifiedwasm32-unknown-unknown
target is not already installedrustup
is available as the toolchain installerThis implementation is based on cargo-wasi's
install_wasi_target
, with the difference that I'm not introducing a cache for the target check.I opted to leave the cache implementation up for discussion mainly because: (i) the cache can potentially introduce false positives if for example, the user removes the target manually after running
build
orcheck
for the first time, so if we go ahead with the implementation we might need to think about an "eviction" mechanism analogous tocargo wasi self clean
or think of a different caching approach (ii) cargo-wasi has several use-cases for the cache: one being the target installation and the other one being update-checks, perhaps if update checks is something that we want to implement we could add the caching at that time? Right now we'd mostly be saving therustc --print sysroot
invocation. Thoughts?